package myAsm;

import java.util.Map;

import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Transient;

import org.objectweb.asm.MethodVisitor;


@Entity
@DiscriminatorValue("INSN_TYPE")
public class MyTypeInsnNode extends MyAbstractInsnNode {

	 /**
     * The operand of this instruction. This operand is an internal name (see
     * {@link org.objectweb.asm.Type}).
     */
	@Column(name="TYPEINSN_DESC")
    public String desc;

	 public MyTypeInsnNode() {
	        super(-1);
	    }
	
    /**
     * Constructs a new {@link TypeInsnNode}.
     * 
     * @param opcode the opcode of the type instruction to be constructed. This
     *        opcode must be NEW, ANEWARRAY, CHECKCAST or INSTANCEOF.
     * @param desc the operand of the instruction to be constructed. This
     *        operand is an internal name (see {@link org.objectweb.asm.Type}).
     */
    public MyTypeInsnNode(final int opcode, final String desc) {
        super(opcode);
        this.desc = desc;
    }

    /**
     * Sets the opcode of this instruction.
     * 
     * @param opcode the new instruction opcode. This opcode must be NEW,
     *        ANEWARRAY, CHECKCAST or INSTANCEOF.
     */
    public void setOpcode(final int opcode) {
        this.opcode = opcode;
    }

    public int getType() {
        return TYPE_INSN;
    }

    public void accept(final MethodVisitor mv) {
        mv.visitTypeInsn(opcode, desc);
    }

    public MyAbstractInsnNode clone(final Map labels) {
        return new MyTypeInsnNode(opcode, desc);
    }
}